<template>
  <a-modal :maskClosable="true" :title="title" :visible="visible" width=800 @cancel="cancel" @ok="handleOk">
    <a-card :bordered="false">
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="外围系统">
                <a-input placeholder="请输入外围系统" v-model="queryParam.exoSystemCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="所属单位">
                <a-input placeholder="请输入所属单位" v-model="queryParam.orgCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- 查询区域-END -->
      <!--用户列表-->
      <a-table
              ref="table"
              size="small"
              rowKey="id"
              :columns="columns"
              bordered
              :dataSource="dataSource"
              :pagination="ipagination"
              :loading="loading"
              :rowSelection="rowSelection"
              class="j-table-force-nowrap"
              @change="handleTableChange"
      >
      </a-table>
    </a-card>


  </a-modal>
</template>

<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: 'MsiExoSystemListPop',
    mixins: [JeecgListMixin],
    components: {},
    data() {
      return {
        visible: false,
        title: '选择外围系统',
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'外围系统',
            align:"center",
            dataIndex: 'exoSystemCode'
          },
          {
            title:'外围系统描述',
            align:"center",
            dataIndex: 'exoSystemName'
          },
          {
            title:'所属单位',
            align:"center",
            dataIndex: 'orgCode'
          },
          {
            title:'所属单位描述',
            align:"center",
            dataIndex: 'orgName'
          },
        ],
        defQueryParam: { status: '1' },
        url: {
          list: "/msibase/msiExoSystem/list",
        },
      }
    },
    computed: {
      rowSelection() {
        return {
          //type: 'checkbox',
          type: 'radio',
          selectedRowKeys: this.selectedRowKeys,
          onChange: (selectedRowKeys, selectedRows) => {
            this.onSelectChange(selectedRowKeys, selectedRows)
          },
        }
      }
    },
    methods: {
      hide() {
        this.visible = true
        this.queryParam = this.defQueryParam
        this.loadData()
        this.onClearSelected()
      },
      cancel() {
        this.visible = false
      },
      handleOk() {
        const that = this
        let selectionRows = this.selectionRows
        if (selectionRows.length == 0) {
          this.$message.error('尚未选择任何明细')
        }
        this.$emit('ok', selectionRows)
        this.visible = false
      },
      searchQuery() {
        this.queryParam = Object.assign({}, this.defQueryParam, this.queryParam)
        this.loadData(1)
      },
      searchReset() {
        this.queryParam = this.defQueryParam
        this.loadData(1)
      },
    }
  }
</script>

<style scoped>
</style>
